'use strict';

// 试题审核通过
exports.main = async (event, context) => {

	const db = uniCloud.database();
	const collection = db.collection('collection_subject');

	// 插入单条数据
	if (event.subject) {
		let res = await collection.where({
			title: event.subject.title
		}).update({
			isSubject: true,
		});
		return {
			code: '1',
			msg: 'success',
		};
	}

	return {
		code: '0',
		msg: 'fail',
	};


};
